From: Eli Zaretskii Date: Wed, 18 Mar 2009 20:37:06 +0000 (+0000) Subject: (Fuser_login_name): Support float arguments. Doc fix. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~421^2~1183 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=80ad2f27cd986656aa4b86682c187051e1888566;p=emacs.git (Fuser_login_name): Support float arguments. Doc fix. --- diff --git a/src/editfns.c b/src/editfns.c index 2d45dba8fce..cfce1f2add6 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1278,12 +1278,13 @@ This is based on the effective uid, not the real uid. Also, if the environment variables LOGNAME or USER are set, that determines the value of this function. -If optional argument UID is an integer, return the login name of the user -with that uid, or nil if there is no such user. */) +If optional argument UID is an integer or a float, return the login name +of the user with that uid, or nil if there is no such user. */) (uid) Lisp_Object uid; { struct passwd *pw; + uid_t id; /* Set up the user name info if we didn't do it before. (That can happen if Emacs is dumpable @@ -1294,9 +1295,9 @@ with that uid, or nil if there is no such user. */) if (NILP (uid)) return Vuser_login_name; - CHECK_NUMBER (uid); + id = (uid_t)XFLOATINT (uid); BLOCK_INPUT; - pw = (struct passwd *) getpwuid (XINT (uid)); + pw = (struct passwd *) getpwuid (id); UNBLOCK_INPUT; return (pw ? build_string (pw->pw_name) : Qnil); }